package com.nian.redis.service.controller;

import com.nian.redis.cache.JedisClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 用途：
 * 开发：zhangmj
 * 日期：2020/4/4 0004 16:03
 */
@RestController
@RequestMapping("cache")
public class RedisAPIImpl {

    @Autowired
    private JedisClient jedisClient;

    @GetMapping("/getInfo")
    public String getInfo(String key){
        return jedisClient.get(key);
    }

    @GetMapping("/get/{key}")
    public String get(@PathVariable("key") String key){
        return jedisClient.get(key);
    }

    @PostMapping("/set/{key}")
    public String set(@PathVariable("key") String key , @RequestBody String value){
        return jedisClient.set(key, value);
    }



}
